import Vue from 'vue';
import store from './store';
import VueRouter from 'vue-router';
import VueResource from 'vue-resource';
require('vue-swipe/dist/vue-swipe.css');
import { Swipe, SwipeItem } from 'vue-swipe';
import App from './App';

/* 载入模板 */
import 'common/stylus/index.styl';

Vue.use(VueRouter);
Vue.use(VueResource);
Vue.component('swipe', Swipe);
Vue.component('swipe-item', SwipeItem);

/* 载入跳转路径 */
const routes = [
];

const router = new VueRouter({
  mode: 'history',
  linkActiveClass: 'active',
  routes
});

// 登陆跳转模块
// const routeMatch = ['appoint', 'myself', 'coaches'];
// router.beforeEach((to, from, next) => {
//   let nowpath = to.fullPath.split('?')[0];
//   let bmatch = routeMatch.filter(value => nowpath.indexOf(value) > -1);
//   if (bmatch.length !== 0 && !window.localStorage.cphone) {
//     next({path: '/login/?redireat_url=' + escape(to.fullPath)});
//   } else {
//     next();
//   }
// });

/* eslint-disable no-new */
Vue.http.options.root = 'http://cj.lightway.cc';
Vue.http.options.emulateJSON = true;
new Vue({
  el: '#app',
  store,
  router,
  render: h => h(App)
});
